/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.ipti.br.tag.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import org.ipti.br.tag.util.EncryptionUtil;

/**
 *
 * @author ipti
 */
@Entity
public class Questions extends AbstractEntity{
    
    @Column(name = "name")
    private String name;
    
    @Column(name = "agreement_required")
    private Boolean agreementRequired;
    
    public Questions(){
    }

    @Override
    public void generateHash(){
        if(getId() == null){
            String hash = "" + this.getName();
            this.setId(Long.valueOf(EncryptionUtil.encrypt(hash).hashCode()));
        }
    }

    public Questions(String name, Boolean agreementRequired) {
        this.name = name;
        this.agreementRequired = agreementRequired;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Boolean isAgreementRequired() {
        return agreementRequired;
    }

    public void setAgreementRequired(Boolean agreementRequired) {
        this.agreementRequired = agreementRequired;
    }
}
